//  自定义hook 函数 ,实现获取当前页面点击位置的坐标
import { reactive, onMounted, onUnmounted } from 'vue'
const getpoint = () => {
    let point = reactive({
        x: 0,
        y: 0,
    });
    onMounted(() => {
        document.onclick = function(event) {
            // console.log(event.pageX, event.pageY);
            point.x = event.pageX;
            point.y = event.pageY;
        };
    });
    onUnmounted(() => {
        document.onclick = null;
    });

    return point
}

export default getpoint